/*
 * 捕鱼达人充值支付宝服务窗页面专用JS,不可和bydr.pay-*.js同时引用
 * */
$(document).ready(function(){
	var nickName = getCookie('lastInfullNickName');
	nickName = nickName == null ? "" : nickName;
	var nickName = decodeURIComponent(nickName);
	$('#inputName').val(nickName);
});

BydrPay = function(me){
	return me = {
		select : function(propType, propId, propName, propDesc, amount) {
			// 设置金额和提示
			$('#infullAmount').val(amount);
			$('#amount_title').html(amount + "元");
		
			// 设置道具信息
			$('#propType').val(propType);
			$('#propId').val(propId);
			$('#propName').val(propName);
			$('#propDesc').val(propDesc);
			$('#prop_name_title').html(propName);
			
			// 点击框内容切换
			$('#init_click_btn').hide();
			$('#after_click_btn').show();
			
			// 隐藏商品选择框
			BydrPay.hideGoods();
		},
		
		// 显示商品和价格
		showGoods : function() {
			$('#goods_list').toggle();
		},
		
		hideGoods : function() {
			$('#goods_list').hide();
		},
		
		tabChange : function(type) {
			$("#goods_list ul").each(function(){
				$(this).hide();
			});
			
			$(".tab_pay a").each(function(){
				$(this).removeClass("on");
			});
			
			$('#tab_' + type).show();
			$('#title_' + type).addClass("on");
		},
		
		trimInputField : function(target) {
			var value = $(target).val();
			$(target).val(value.trim());
		},
		
		notOpen : function() {
			pookui.alert("即将开放，敬请期待", 3);
		},
		jumpCard : function() {
			// 充值帐号
			var inputName = $('#inputName').val().trim();
			if (!inputName) {
				pookui.alert('请输入充值帐号信息', 3);
				return;
			}
			window.location = "../bydr/carrier_card.html?" + "nickName=" + inputName;
		},
		jumpCardPage : function(infullType) {
			// 充值帐号
			var inputName = $('#inputName').val().trim();
			if (!inputName) {
				pookui.alert('请输入充值帐号信息', 3);
				return;
			}
			window.location = "../bydr/carrier_card.html?" + "nickName=" + inputName + "&infullType=" + infullType;
		},
		recordNickName : function(target) {
			BydrPay.trimInputField(target)
			var value = $(target).val();
			if (value != null && value != "" && value.length > 0) {
				setCookie('lastInfullNickName', value, 3650);
			}
		}
	};
}();